// Package routers
// @APIVersion 1.0.0
// @Title cubeAdmin API
// @Description beego has a very cool tools to autogenerate documents for your API
// @Contact astaxie@gmail.com
// @TermsOfServiceUrl http://beego.me/
// @License Apache 2.0
// @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
package routers

import (
	"cubeAdmin/common/widget"
	"cubeAdmin/controllers/basis"
	"cubeAdmin/controllers/system"
	"cubeAdmin/controllers/tools"
	"github.com/beego/beego/v2/server/web"
)

func init() {
	//移动端路由
	//ns2 := beego.NewNamespace("/v1",
	//	beego.NSNamespace("/mem",
	//		beego.NSInclude(),
	//	),
	//)
	//beego.AddNamespace(ns2)

	// 初始化加载组件
	widget.LoadWidget()

	//管理后台路由
	ns1 := web.NewNamespace("/system",
		web.NSNamespace("/auth",
			web.NSInclude(
				&system.LoginController{},
			),
		),
		web.NSNamespace("/user",
			web.NSInclude(
				&system.UserController{},
			),
		),
		web.NSNamespace("/menu",
			web.NSInclude(
				&system.MenuController{},
			),
		),
		web.NSNamespace("/dict",
			web.NSInclude(
				&system.DictController{},
			),
		),
		web.NSNamespace("/dictDetail",
			web.NSInclude(
				&system.DictDetailController{},
			),
		),
		web.NSNamespace("/dept",
			web.NSInclude(
				&system.DeptController{},
			),
		),
		web.NSNamespace("/job",
			web.NSInclude(
				&system.JobController{},
			),
		),
		web.NSNamespace("/roles",
			web.NSInclude(
				&system.RoleController{},
			),
		),
		web.NSNamespace("/log",
			web.NSInclude(
				&system.RoleController{},
			),
		),
		web.NSNamespace("/config",
			web.NSInclude(
				&system.SysConfigController{},
			),
		),
		web.NSNamespace("/configDetail",
			web.NSInclude(
				&system.SysConfigDetailController{},
			),
		),
		web.NSNamespace("/webConfig",
			web.NSInclude(
				&system.ConfigWebController{},
			),
		),
		web.NSNamespace("/file",
			web.NSInclude(
				&basis.IoController{},
			),
		),
	)
	web.AddNamespace(ns1)
	ns2 := web.NewNamespace("tools",
		web.NSNamespace("toolWebsite",
			web.NSInclude(
				&tools.ToolWebsiteController{},
			),
		),
	)
	web.AddNamespace(ns2)

	web.Router("/login", &system.LoginController{}, "*:LoginIn")
	web.Router("/", &system.HomeController{}, "*:Index")
	web.Router("/console", &system.HomeController{}, "*:Console")
}
